package com.winit.cloudlink.mgmt.task;


import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

public enum Status {
    NEW,//创建
    READY,//就绪
    RUNNING, //运行中
    DONE, //完成
    FAILED; //失败

    public static Status getForString(String statusAsString) {
        Assert.hasText(statusAsString, "'statusAsString' must neither be null nor empty.");

        final Status[] grayModeValues = Status.values();

        for (Status grayMode : grayModeValues) {
            if (statusAsString.equalsIgnoreCase(grayMode.name())) {
                return grayMode;
            }
        }
        throw new IllegalArgumentException("Invalid grayMode '" + statusAsString
                + "'. The (case-insensitive) supported values are: "
                + StringUtils.arrayToCommaDelimitedString(grayModeValues));
    }
}
